#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 wanghch <wanghch@wanghch-pc>
#
# Distributed under terms of the MIT license.

"""

"""
# jqdatasdk for local use
from jqdatasdk import *
from jq_utils import *

# jqdata for offical website use
# from jqdata import *
import datetime
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
pd.reset_option('display.float_format')

sdk_auth()

kc50 = get_index_weights('000688.XSHG').sort_values(['weight'], ascending = False)

sh = get_index_weights('000001.XSHG').sort_values(['weight'], ascending = False)
# sh.head(150)
sz = get_index_weights('399001.XSHE').sort_values(['weight'], ascending = False)
# sz.head(150)


df = pd.concat([sh.head(300), sz.head(300), kc50])
df['code'] = df.index
df.to_csv("clist.csv", index = False)
